// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/*!
 * @file timesync_status.cpp
 * This source file contains the definition of the described types in the IDL file.
 *
 * This file was generated by the tool gen.
 */

#ifdef _WIN32
// Remove linker warning LNK4221 on Visual Studio
namespace { char dummy; }
#endif

#include "timesync_status.h"
#include <fastcdr/Cdr.h>

#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>



timesync_status::timesync_status()
{
    // m_timestamp_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@6e6c3152
    m_timestamp_ = 0;
    // m_source_protocol_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@50b494a6
    m_source_protocol_ = 0;
    // m_remote_timestamp_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@3cef309d
    m_remote_timestamp_ = 0;
    // m_observed_offset_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@32709393
    m_observed_offset_ = 0;
    // m_estimated_offset_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@3d99d22e
    m_estimated_offset_ = 0;
    // m_round_trip_time_ com.eprosima.idl.parser.typecode.PrimitiveTypeCode@49fc609f
    m_round_trip_time_ = 0;

}

timesync_status::~timesync_status()
{






}

timesync_status::timesync_status(const timesync_status &x)
{
    m_timestamp_ = x.m_timestamp_;
    m_source_protocol_ = x.m_source_protocol_;
    m_remote_timestamp_ = x.m_remote_timestamp_;
    m_observed_offset_ = x.m_observed_offset_;
    m_estimated_offset_ = x.m_estimated_offset_;
    m_round_trip_time_ = x.m_round_trip_time_;
}

timesync_status::timesync_status(timesync_status &&x)
{
    m_timestamp_ = x.m_timestamp_;
    m_source_protocol_ = x.m_source_protocol_;
    m_remote_timestamp_ = x.m_remote_timestamp_;
    m_observed_offset_ = x.m_observed_offset_;
    m_estimated_offset_ = x.m_estimated_offset_;
    m_round_trip_time_ = x.m_round_trip_time_;
}

timesync_status& timesync_status::operator=(const timesync_status &x)
{

    m_timestamp_ = x.m_timestamp_;
    m_source_protocol_ = x.m_source_protocol_;
    m_remote_timestamp_ = x.m_remote_timestamp_;
    m_observed_offset_ = x.m_observed_offset_;
    m_estimated_offset_ = x.m_estimated_offset_;
    m_round_trip_time_ = x.m_round_trip_time_;

    return *this;
}

timesync_status& timesync_status::operator=(timesync_status &&x)
{

    m_timestamp_ = x.m_timestamp_;
    m_source_protocol_ = x.m_source_protocol_;
    m_remote_timestamp_ = x.m_remote_timestamp_;
    m_observed_offset_ = x.m_observed_offset_;
    m_estimated_offset_ = x.m_estimated_offset_;
    m_round_trip_time_ = x.m_round_trip_time_;

    return *this;
}

size_t timesync_status::getMaxCdrSerializedSize(size_t current_alignment)
{
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

size_t timesync_status::getCdrSerializedSize(const timesync_status& data, size_t current_alignment)
{
    (void)data;
    size_t initial_alignment = current_alignment;


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);


    current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);



    return current_alignment - initial_alignment;
}

void timesync_status::serialize(eprosima::fastcdr::Cdr &scdr) const
{

    scdr << m_timestamp_;
    scdr << m_source_protocol_;
    scdr << m_remote_timestamp_;
    scdr << m_observed_offset_;
    scdr << m_estimated_offset_;
    scdr << m_round_trip_time_;
}

void timesync_status::deserialize(eprosima::fastcdr::Cdr &dcdr)
{

    dcdr >> m_timestamp_;
    dcdr >> m_source_protocol_;
    dcdr >> m_remote_timestamp_;
    dcdr >> m_observed_offset_;
    dcdr >> m_estimated_offset_;
    dcdr >> m_round_trip_time_;
}

/*!
 * @brief This function sets a value in member timestamp_
 * @param _timestamp_ New value for member timestamp_
 */
void timesync_status::timestamp_(uint64_t _timestamp_)
{
m_timestamp_ = _timestamp_;
}

/*!
 * @brief This function returns the value of member timestamp_
 * @return Value of member timestamp_
 */
uint64_t timesync_status::timestamp_() const
{
    return m_timestamp_;
}

/*!
 * @brief This function returns a reference to member timestamp_
 * @return Reference to member timestamp_
 */
uint64_t& timesync_status::timestamp_()
{
    return m_timestamp_;
}

/*!
 * @brief This function sets a value in member source_protocol_
 * @param _source_protocol_ New value for member source_protocol_
 */
void timesync_status::source_protocol_(uint8_t _source_protocol_)
{
m_source_protocol_ = _source_protocol_;
}

/*!
 * @brief This function returns the value of member source_protocol_
 * @return Value of member source_protocol_
 */
uint8_t timesync_status::source_protocol_() const
{
    return m_source_protocol_;
}

/*!
 * @brief This function returns a reference to member source_protocol_
 * @return Reference to member source_protocol_
 */
uint8_t& timesync_status::source_protocol_()
{
    return m_source_protocol_;
}

/*!
 * @brief This function sets a value in member remote_timestamp_
 * @param _remote_timestamp_ New value for member remote_timestamp_
 */
void timesync_status::remote_timestamp_(uint64_t _remote_timestamp_)
{
m_remote_timestamp_ = _remote_timestamp_;
}

/*!
 * @brief This function returns the value of member remote_timestamp_
 * @return Value of member remote_timestamp_
 */
uint64_t timesync_status::remote_timestamp_() const
{
    return m_remote_timestamp_;
}

/*!
 * @brief This function returns a reference to member remote_timestamp_
 * @return Reference to member remote_timestamp_
 */
uint64_t& timesync_status::remote_timestamp_()
{
    return m_remote_timestamp_;
}

/*!
 * @brief This function sets a value in member observed_offset_
 * @param _observed_offset_ New value for member observed_offset_
 */
void timesync_status::observed_offset_(int64_t _observed_offset_)
{
m_observed_offset_ = _observed_offset_;
}

/*!
 * @brief This function returns the value of member observed_offset_
 * @return Value of member observed_offset_
 */
int64_t timesync_status::observed_offset_() const
{
    return m_observed_offset_;
}

/*!
 * @brief This function returns a reference to member observed_offset_
 * @return Reference to member observed_offset_
 */
int64_t& timesync_status::observed_offset_()
{
    return m_observed_offset_;
}

/*!
 * @brief This function sets a value in member estimated_offset_
 * @param _estimated_offset_ New value for member estimated_offset_
 */
void timesync_status::estimated_offset_(int64_t _estimated_offset_)
{
m_estimated_offset_ = _estimated_offset_;
}

/*!
 * @brief This function returns the value of member estimated_offset_
 * @return Value of member estimated_offset_
 */
int64_t timesync_status::estimated_offset_() const
{
    return m_estimated_offset_;
}

/*!
 * @brief This function returns a reference to member estimated_offset_
 * @return Reference to member estimated_offset_
 */
int64_t& timesync_status::estimated_offset_()
{
    return m_estimated_offset_;
}

/*!
 * @brief This function sets a value in member round_trip_time_
 * @param _round_trip_time_ New value for member round_trip_time_
 */
void timesync_status::round_trip_time_(uint32_t _round_trip_time_)
{
m_round_trip_time_ = _round_trip_time_;
}

/*!
 * @brief This function returns the value of member round_trip_time_
 * @return Value of member round_trip_time_
 */
uint32_t timesync_status::round_trip_time_() const
{
    return m_round_trip_time_;
}

/*!
 * @brief This function returns a reference to member round_trip_time_
 * @return Reference to member round_trip_time_
 */
uint32_t& timesync_status::round_trip_time_()
{
    return m_round_trip_time_;
}


size_t timesync_status::getKeyMaxCdrSerializedSize(size_t current_alignment)
{
    size_t current_align = current_alignment;









    return current_align;
}

bool timesync_status::isKeyDefined()
{
   return false;
}

void timesync_status::serializeKey(eprosima::fastcdr::Cdr &scdr) const
{
    (void) scdr;
     
     
     
     
     
     
}
